<?php
require_once 'application/library/helper/userDataHelper.php';
require_once 'application/constant/constant.php';

/** 
 * gcUserCompetence
 * @author    Soochow University
 * @version   1.0
 * @exclude   作  成  日：2011/04/07
 */
class gcUserCompetence{
    /**
     * 用户资格验证
     * isCompetence
     * @param   string  $strModuleName
     * @param   string  $controllerName
     * @param   string  $actionName
     * @return  boolen
     */
    public function isCompetence($moduleName,$controllerName,$actionName){
        $strUrl = $moduleName ."/". $controllerName."/". $actionName;
        $arrAuthority=userDataHelper::getAuthority();
        foreach ($arrAuthority as $arrayKey=>$value){
            $strAuthUrl=$value["URL"];
            $strAuthLevel=$value["AUTH_LEVEL"];
            if(strtoupper($strUrl)===strtoupper($strAuthUrl)){
                if($strAuthLevel===sysConstant::USER_AUTH_ID_NO){
                    return false;
                }elseif ($strAuthLevel===sysConstant::USER_AUTH_ID_EXIST) {
                    return true;
                }
            }
        }
        return true;
    }
}
